| Modifier and Type | Field | Description |
|---|---|---|
private int |
itemCode |
|
private float |
itemCost |
|
private java.lang.String |
itemName |
|
private float |
itemPrice |
|
private int |
itemQuantityInStock |
| Constructor | Description |
|---|---|
FoodItem() |
Default Constructor
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
addItem(java.util.Scanner scanner) |
Reads from the Scanner object passed in and fills the data member fields of the class with valid data.
|
boolean |
inputCode(java.util.Scanner scanner) |
Reads a valid itemCode from the Scanner object and returns true/false if successful
|
boolean |
isEqual(FoodItem item) |
Compares this object's item code with the one passed in
|
java.lang.String |
toString() |
|
boolean |
updateItem(int amount) |
Updates the quantity field by amount (note amount could be positive or negative)
|
private int itemCode
private java.lang.String itemName
private float itemPrice
private float itemCost
private int itemQuantityInStock
public boolean addItem(java.util.Scanner scanner)
scanner - - Scanner to use for inputtrue if all data members were successfully populated, false otherwisepublic boolean inputCode(java.util.Scanner scanner)
scanner - - Scanner to use for inputtrue if code was populated, false otherwisepublic boolean isEqual(FoodItem item)
item - - object to compare withtrue if the itemCode of the object being acted on and the item object parameter are the same value, false otherwisepublic boolean updateItem(int amount)
amount - - what to update by, either can be positive or negativetrue if successful, otherwise returns falsepublic java.lang.String toString()
toString in class java.lang.Object